Hệ thống quản lý trường đại học bằng PHP

1 <?php
2     require_once(
'includes/config.php');
3     
if(isset($_POST['submit'])){
4         extract($_POST);
5         
try {
6             $stmt = $db->prepare(
'SELECT COUNT(*) FROM etudiant WHERE cin = :cin AND carteEtudiant = :carteEtudiant') ;
7             $stmt->execute(array(
8                 
':cin' => $cin,
9                 
':carteEtudiant' => $studcard
10             ));
11             $resp = $stmt->fetch();
12             
if (intval($resp[0]) == 1) {
13                 $hashedpassword = $user->password_hash($passwd, PASSWORD_BCRYPT);
14                 echo $accname.
"<br />";
15                 echo $hashedpassword.
"<br />";
16                 echo $mail.
"<br />";
17                 echo $cin.
"<br />";
18                 $reqz = $db->prepare(
'INSERT INTO users (username,password,email,CIN,isadmin) VALUES (:username,:password,:email,:CIN,:isadmin)') ;
19                 $reqz->execute(array(
20                     
':username' => $accname,
21                     
':password' => $hashedpassword,
22                     
':email' => $mail,
23                     
':CIN' => $cin,
24                     
':isadmin' => '0'
25                 ));
26                 $user->login($accname,$passwd);
27             }
28
29             header(
'Location:index.php');
30             exit;
31         }
catch(PDOException $e) {
32             echo $e->getMessage();
33         }
34     }
35 ?>


Gõ tìm kiếm nhanh...